<template>
	<div>
		<el-tabs v-model="activeName" @tab-click="handleTabChange">
			<el-tab-pane label="基础信息" name="BaseDetail"></el-tab-pane>
			<el-tab-pane label="扩展信息" name="Extend"></el-tab-pane>
			<el-tab-pane label="其他信息" name="Other"></el-tab-pane>

			<div class="content-card">
				<html-label :title="activeLabelTitle"> </html-label>

				<component
          v-if="!Loading"
					:is="whickComm[activeName]"
					:soleKey="`dpServiceOrgBase-${nowRowData.creditCode}`"
					:nowRowData="nowRowData"
					:isWithAuth="0"
					:actionBtn="false"
					:searchConfig="false"
					:ifShowSearch="false"
				></component>
			</div>
		</el-tabs>
	</div>
</template>

<script setup lang="ts">
import BaseDetail from './BaseDetail/index.vue'
import Extend from './Extend/index.vue'
import Other from './Other/index.vue'
import apiMod from '@/apiMod'
import { useCommonStore } from '@/stores/common'

const { setLoading } = useCommonStore()

const whickComm = {
	BaseDetail,
	Extend,
	Other,
}
const activeName = ref('BaseDetail')
type Props = {
	nowRowData?: any
}
const Loading = ref(false)

const props = withDefaults(defineProps<Props>(), {})
const baseData = ref({})
provide('nowRowData',baseData)


const getInitData = () => {
  setLoading(true)
  Loading.value = true 
	apiMod.view_dpServiceOrgBaseFile_all({creditCode: props.nowRowData.creditCode,}).then((res) => {
    const data = res.data ||{}
    baseData.value = data
    setLoading(false)
    Loading.value = false
	})
}

const emit = defineEmits(['refresh', 'rechange'])
const activeLabelTitle = ref('基本信息')

const handleTabChange = (tab) => {
	activeLabelTitle.value = tab.props.label
}

onMounted(()=> {
  getInitData()
})
</script>

<style scoped></style>
